Skip to content

feat: support Slack webhook URL as alternative to token+channel for all monitors - #126

Draft
dewanshparashar wants to merge 2 commits into
mainfrom
feat/slack-webhook-support
Draft

feat: support Slack webhook URL as alternative to token+channel for all monitors#126
dewanshparashar wants to merge 2 commits into
mainfrom
feat/slack-webhook-support

Conversation

@dewanshparashar

Copy link
Copy Markdown
Contributor

Summary

All three monitors (retryable, batch-poster, assertion) now support either-or Slack configuration:

  • Webhook URL (preferred) — set <MONITOR>_SLACK_WEBHOOK_URL to a Slack incoming webhook. Webhooks are scoped to a single channel, so they're less prone to abuse than a bot token.
  • Bot token + channel (existing) — <MONITOR>_SLACK_TOKEN + <MONITOR>_SLACK_CHANNEL, unchanged.

If both are configured, the webhook takes precedence. This lets us migrate monitor-by-monitor: set the webhook secret, verify alerts arrive, then drop the token/channel pair.

Changes

  • createSlackPoster (shared by all monitors) accepts an optional webhookUrlEnvVar; if neither config is present it throws an error naming both options.
  • New postSlackMessageViaWebhook in packages/utils posts via native fetch (no new dependency), preserving existing behavior: GitHub CI run link appended, message sanitized, unfurl_links: false. Throws on non-2xx without leaking the webhook URL.
  • DEV skip and CI-"success" skip behaviors apply to both paths.
  • New env vars wired for all three monitors: RETRYABLE_MONITORING_SLACK_WEBHOOK_URL, BATCH_POSTER_MONITORING_SLACK_WEBHOOK_URL, ASSERTION_MONITORING_SLACK_WEBHOOK_URL.
  • Updated .env.sample, root README, and all three package READMEs.

Testing

  • Extended createSlackPoster test suite from 6 to 13 tests: webhook precedence, webhook-only config, token+channel fallback, and the new error message. All 20 utils tests pass.
  • All three monitor packages typecheck cleanly.

🤖 Generated with Claude Code

…ll monitors

Each monitor's Slack poster now works on an either-or config basis:
- SLACK_WEBHOOK_URL env var (preferred: incoming webhooks are scoped
  to a single channel, less prone to abuse), or
- SLACK_TOKEN + SLACK_CHANNEL (existing behavior, unchanged)

If both are configured, the webhook takes precedence.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@dewanshparashar
dewanshparashar force-pushed the feat/slack-webhook-support branch from 40a8a9c to d3f1cb0 Compare July 23, 2026 08:56
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant